refactored median (still borked), mathTest changes

passes all mathTest tests other than test_median