Create an array smoothing function