Adding decimate function.