Split up into server and client