Added a beforeRender and afterRender trigger