refactorefactorefactor; finally using primitives to parameterize states in a way that makes the basis of a state part of that state's type