Refactored sudoku checker