Refactor && c++11 compliant