Remove redundant `while`