[WIP] Imran's new RMSD code