reafactoring REST calls