some refactoring (c++11)