start of discoverStatesAndRules implementation