WIP, fixing #107 turned out hairier than expected