Reworked server code.