Added destroy method that closes the connection and unsets the variable.
Removed timeouts and wrote state-handling code instead.