Improvements (mostly from c++11)