Add judging function.