Added some inline documentation to api.js