Added method to check if a cell is a valid move