added comments
cosmetic refactoring