document code generator improvement finished and several fixes