IM: Averaging function added, tolerance function needed to balance this out.