rest refactoring