cleanup of failed merge
moving some CA specific code into a separate file