minor refactor of findStateg