Add state pattern.