Added more arguments to DISCONNECTED event in case of error.
Made statements more readable.