Changed from Java to C++