Thermal formation and chlorination of dioxins and dioxin-like compounds