Use standard for loop instead of forEach

IE8 and other older browsers don't support ECMAScript 5's Array.prototype.forEach. We don't really
need it so it's now replaced with a good old for loop which should work in pretty much every
browser known to mankind.