More work on the router, also added basic error handling
More work on the router