debounced visibility checking, removed global state