Make it work for all connections, refactor

* Add some better docs