Refine state pattern sample