Updated code to most recent C++ version