adjust position generation algorithm.