C++ server code

Latest master merged in. We should discuss the layout of the code.
how come we are assigning result here? It looks like we are updating match but not using result after this.