built MDS into code working only on unique points for efficiency