Changed to use auto.
Refactored using variety of C++11 features like auto, nullptr, and so on.
Changed to pass a lambda expression to std::sort().