Break out client connection setup and sending messages to clients into their own functions