Demo of how to use the state pattern (has a factory in there too)