Role of titanium imido in C--N bond formation : mechanism and synthesis of pyrroles and secondary allylic amines