rest adapter refactor