added code for median...tested it with various array lengths and numbers