Replaced for loops with while loops for compiler happiness!
Authored by: SumolX 2007-11-30
Parent: [r1075]
Child: [r1077]