Implements router.