Created classes for each of the line types

The code for getting the html for a line was quite clunky.  This is a
bit of an improvement but it could still be better.