Added logic to identify indirect routes