cleanup cg code
prototypes correction