Added debug levels. More info in plugin description.
Drastically simplified connection code