more refactoring for c++11