Refactored: separated client/server.