Add boilerplate code for life cycle events