add deduplication to SortAndDedupTriplesApp and preliminary work on counters