modified sort-bed doc