refactor _no_missing_states function