Router logic