Large refactor using maps, better extends

Most of this is a straight refactor, generated output is the same however there are a few additional extends and surgical classes.
Same question here as the `.display-block` thing.