Corrected median calculation. I got confused..