renamed cg to heap (see a44a31e4ded4bd66d593e8053fddc10a7f302136)