cg code reorganisation.