Cg support

Related to #335