Still not sure how I screwed up the first time around. I've updated the script to use a heredoc