added comments
refactoring