Refactored connection logic.
Merge branch 'master' of https://github.com/WinToosa/mobilelogger.git