calculating median
everything is working
everything works
almost done - everything works
everything done
added some comments