refactoring the routes_for to resthandler