deduplicated code