updated the api and now a router instance is a function too