Changed logic of sudoku solver