implemented averagingFilter