Thermal reactions of polyacrylonitrile