Move the if status ..  to the beginning of the main loop.