MemSortAndDedup.scala updated