Add support for closures in routing