Documentation and cleanup of code.