Replaced forEach as not supported in IE 6-8 (#295)