Refactored around http server function.