Refactor dup logic into inline function