Added logic for adding a goal.