Finish the rest layer refactoring