Properly handle nil OptimizlyId

And some minor formatting updates to make the HTML output cleaner and more concise.