Refactor to make files more domain specific, injected factory to consume API

Still battling with CORS issue. Will need to fix that