reverted to medfilt2d, much faster