Fixed a couple cppcheck warnings.
Removed foreach macro.