minor edits to cgp.c