Improved the compare-dest/link-dest/copy-dest code to make it more