apply state pattern.