Note: the itest is broken up into multiple commits to make it more readable, they can be squashed post-review.