merged server-client stuff