refactor post and get object functions