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

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

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