Refactoring into separate client/server files