Some while optimizations