Synthesis of pyrrolizidine and indolizidine ring systems via N-chloramine rearrangement