change the return type of deduplicate from generator to list