Code cleanup + CAIII cert fix