refactored the http calls