added median solving probelm