adding state pattern example