initial working csg version!