add global state pattern