Moved into promises
Moved stuff into API