Clean up code. Optimise for each. Reuse code that does the flag checking and setting.
Clean up code. Optimise for each. Reuse code that does the flag checking and setting.
Refactor lifecycle flag setting / getting.