Add ability to sort document keys fixes #5