Minor refactoring, added comments