refactored getCellNeighbors for brevity (removed 30+ LOC)