Fixed some bugs.
Changed the calculation for statistics