Clean up some CSS and collapse lots of the repeated html generation into a single method.