Replacing whiles with for loops after re-reading Haxe docs.