implement simple middlewares for rendering