Refactor router arrangement and use locals