Refactor our Router class and improve the tests