updated CCBatch (more optimizations and type-safety,
enforcing some structural constraints with GADT)