add state pattern.