Ring opening reactions of nitrogen heterocycles