add beforeRender argument