started to implement logic for checking perimeter cells, removed some hard-coded numeric values