More work on moving things to api.js
More work on moving things to api.js