first version of computeStats method