Dedupe code and switch to shared doc fragments