modified ccgs_common.cpp