Adding state pattern