adding state pattern