refactor check_route method