First draft of state pattern. Needs more work and cleaning up