implemented isGoal for multiple end states