refactored some code, added comments