Refactor to be a real api.