changed the goal function