Optimisations and modifications to server.