Remove hasRoute method from router.php, and shorten control structures