Change "while !" to until