Reorganise code in cg and nitech modules.