Add state pattern.
Add state pattern.