Further cleanup and documentation.