Deduplicate renderer code