add cg optimization and some logging information