Use do while instead of while(true)