A Versatile Modification of the Hofmann Rearrangement