Minor optimize to main loop.