Fixing Up prioritize_states()

I had a hankering to fix this function. I'm interested in looking at the rest of the codebase, as the extension works well, but this is what I happened upon first.

A note: reverse() doesn't actually sort; it just reverses the array wholesale.