C++ implementation added (buggy ATM).