added ability for calculating number of cells only