A lot of this stuff is duplicated between this Q and the first. Not that it stops the PR being merged, but as a note-to-self it would be cool to see if we can reduce some of the duplication at some point in the future.