re-edit to work in server-client mode