building on the twine-state example in two ways