made a new algorithm for getting the median
merged the new median into navigation branch
Fixed a kind of T junktion, also made a better algorithm for medians