added working median filter with quick select algorithm