Stereocontrolled amidocyclisations with phenylthio migration