refactoring. using c++11