Improve median_filter and test suites