added state pattern demo