refactor dispatch behavior into bootstrap.php