Handle lifecylce hooks and refs