Added clientstate object to use events to hold state of client in main thread