refactored all gets to the api into factories.js