Added code for median