refactored code, clarified method names