optimization. Removing maxPos