Add support for specifying sort order, closes #7