Discriminator-based sorting.
typo
Fix undefined.
Merge pull request #2 from samth/master

Fix undefined.
Merge pull request #3 from carl-eastlund/master

catch up stable