add error checking for route