Terrible, terrible code for multidimensional scaling. Please don't try to use this mess.