Refactoring the Router.php and doing some tests.