added changes for statistics calculations