Factor TAP writing out into its own file.