Changed to use life cycle call backs