Refactoring of debug module. Use c++11 features.