Ported from C++ to Java for simultaneous deployment in Node servers.