refactor xgroup to use xprojection while calculate projection