Break the writing out into its own method.