Updated routes to better handle errors