Refactored HTTP logic into a seperate service