Removing halogens or halogen compounds