adding median filtering option