Added C++ and Scala implementations.