Pre-work clean-up

heredoc, indentation, preparing for JS-rewrite.