Modified so that c++11 is not required