factored out the HEREDOC scripts