Put ENABLE_BUILD_OPTIMIZATIONS on by default so that linker flags comply with MGL and we get no warnings.
Rename foreach2 to forEach.