Adding working CG code\!