Some preliminary work on issue #6. Breaks a lot of tests. [skip ci]