Refactored http request related code to a seperate module