Revert "Revert "More work on #42""

This reverts commit 7e9d8cd275a20093fdced3f2545b4a964dac6a20.