rest refactor