Remove the modification of global variables from double-stroke functions, add local "median" variable instead.