dedup code