deduplicate code