some cleanup of code and documentation