Remove enum classes, a C++11 feature
Removal of several foreach loops and more enum class usage (C++11)
Fix a shadowed variable