Break up rendering code into a few smaller functions.
Simple example of including a diagram in an HTML page.