Synthesis of substituted azetidines and spirocyclic diazetidines