Minor inf loop optimization