code cleanup/commenting/refactoring