Higher level IPC abstraction (fixes 238)

This is mostly refactoring.

Fixes #238.
That code was moved over as is, so I didn't really think about improving that part. The fact those arguments exist is pretty bad and only useful for testing (thus #125), so I'm not sure exposing them in the public interface is a nice thing to do. Although to be fair I did do it for the config path...

Perhaps that's a thing to do as part of #125, if we can't come up with anything better.