added numcells variable