Lifecycle functions being called correctly