Changed the dist.to.ref and ZelditchMD functions to make them simpler