Refactor to http interface