Add heredoc
Fix stderr + tee redirection
Merge pull request #2 from mrdaemon/master

merge @mrdaemon's cleanup