Added stats and detecting when a client disconnects