Initial logic for matching routes