Processing contaminants: formation, detection and prevention