I see you making this pattern several places in the code to loop through all the states. It seems really inefficient to me. Is there a reason we can't just keep this information precomputed somewhere?