speed up isGoal()