Refactor objective management into functions