Changed language to C++, restructured things a bit