Do not reference undefined variables
Refactor "judge"