refactoring cg variable to be more clear