Improved code quality.
Fixed after merge.
Improved auto-connect behaviour.