Refactor to make routing ruleset easier