Add function cgs
Merge branch 'cgs' into develop