Moved from C++ to scala