Simplify router and add tests