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

Connection handling improvements.