Some cleanup and documentation.