# Synthesis of azacrown molecule

The reaction of the compound in picture with potassium tert-butoxide, pyridine, diethanolamine and 4-toluenesulfonyl chloride group leads to the formation of an azacrown.

It seems that the OH groups of the ether molecule and That of the diethanolamine group react with water elimination to form the azacrown. But then what is the role of the other reagents?

What is the exact reaction mechanism? Please be detailed and show electron movements and type of reaction(e.g.- SN1, E1cB etc.) , if possible.

A double $\mathrm{S_N2}$ reaction yields your product.