refactor to support request instead of straight http