needs c++11 and idiomatic changes