refactored the controller and put all http calls into services