Refactor REST