Reaction mechanisms of polyacrylonitrile on thermal treatment