Updated for C++11.