Refactor lifecycle to be more debuggable