refactored the algorithm for searching alive cells around a cell