Code Revision: Statistical Calculation Changes

Statistical calculations were not performed as desired, the mean and
median calculations have been corrected.