Added lifecycle callbacks.