Adding lifecycle event hooks (beforeRender/afterRender)