Several improvement to work in C++