Change/simplify connections

This is hopefully just the start of a big refactoring in the core of phergie. I think this serie is ready for master, despite the size of a patch that can spoil the review fun a bit.