added median line to code