Improved C++11 version