Changed some code to use c++11 features.