Merge Xiang's Code