new implementation of the Median Filter