Moved lifecycle callback to listener
Corrected execution order