Refactored the Route and Query to handle both in a consistent  way