Optimize the position loop checks, document a major bug