adding nextGeneration and checkNeighbors methods