rewrote comments and renamed functions