refactor out get and post