RestHandler refactored