An unusual substitution reaction directed by an intramolecular re-arrangement