adjusted so that json encoding happens inside the Patterns class and throws exceptions if there's some bad json
added feature flags
added a method to get routes as a hash and one with now docs
re-factored getRoutes to decide which method to use based on feature flags