Refactored HTTP api