more cleanup and documentation