Instead of calling setRoutes every time, use Closure when needed
Adjust factory example to new api