I think this gets most of the issues raised in #424