Added some enhancements in statistics calculation.