Added tests and tweaked escaping in routing.