Reuse write_dispatcher subroutine to remove code from run_once