Median working correctly.
-- lots of unneeded code.