Documentation and cleanup of API