Modified setGoal to allow multiple goals to be set sequentially.