Reorganise some code on the server.