Working version of CollapseC