swapped server and client functions