Added viewFile parameter to beforeRender