Might be worth pulling this out as a utility class (and also, not have the overhead of the `outer` pointer).