Minor refactoring of server-side code