Implemented median and transformed it into a lib solution