replaced boardSize with cells.size()