Reimplemented part of c++ server lib from previous proprietary implementation.