Merge pull request #66 from fanhattan/connection-handling-improvements

Connection handling improvements.
Merge pull request #14 from ryanlecompte/master

Merge pull request #66 from fanhattan/connection-handling-improvements