api documentation and cleanup