remove middlewares, move all code to router instance