made compatible with Mac OS X
upgrade to C++11