Merge with Xiao code