Working CPP version of cube_server