Further evolved the code that generates HTML for fields.