add messages to be sent to server and eliminate system.exit