Clean up for the new code
Switch to C++
Fix infinite loops
Merge pull request #1 from sashamortimer/cpp

Cpp