depend less on global state