Cleanup + c++11ify old code