Refactor duplicates