some cleanup and comments