updated lifecycle code.