add custom sorting order support, closes #1