Rewrite in C++11