Move connection code to private method
Merge pull request #25 from rapid2k1/patch5

Move connection code to private method