Version2.2, loop use i,j type loop to avoid edge effect