prioritize_states() now actually sorts by weight.
The new algorithm also runs in linear time.
Merge pull request #1 from texaswilliam/master

Fixing Up prioritize_states()