Corrected a bug in median filter and made the delay between commands longer