Fixed the error handling
Updated the routing a bit