upgraded lifecycle example to new functionality