Updated deduplicate to use tailOutput