Clean up of cg and fixes of other doctests/formats