C++ Implementation of a lot of stuff