msort modified