utilize more c++ 11 and refactoring