Added DynamicState pattern implementation