Added example state pattern implementation