refactored a bit
more refactoring - getting rid of code comments and cleaning up loops