Change stupid "for" to "while"