refactor to make put requests work.