update some code and connect to new xg 2.0 scheme