Split code into client and server