Use a more efficient method to check states existence.