Issue 31 — Part 1

Quite some changes, but I think this releases #52 #39 (at least when I'm done with this one here on #31) and #75 for others to work on.
Bunch of tests to be added for #52 #39 and #75 as well...