Rewritten defineObjective, updateObjective. Updated tests.