Bump to c++11
Some C++11 oriented refactoring
Move more code to newstyle forloops