still refactoring
moved most of the api into account.js