lots of bug fixes...
addressing comment
Merge pull request #193 from nikhan/new_connections

lots of bug fixes...