some more cleanup and comments