refactor for nested routes