Added quickmedian function, debugged median function