I find a bit confusing defining the client here... could it have been defined outside? I mean, separate the server code from the client logic...