refactor duplicates