split client and server code