Fix sorted?, and allow sort to take comparators