add lifecyccle demo code