Refactor rest ctrl