removing comments and refactoring code