Convert some loops into foreach loops
Merge pull request #56 from lioncash/foreach

Convert some loops into foreach loops