Problems with foreach loop and arrays caused array to grow in size.
Fix problem in for loop where extra ;'s in definition was not detected