Median filter implementing.