Refactor dedupe class