refactored some code, added comments, renamed functions better
renamed functions, removed couts, refactored code slightly, added comments