can compare states, about to refactor to eliminate global variables: