Converted some foreach's to for.
Merge remote-tracking branch 'origin/master'