state pattern.