Refactor to be customizable.

@sebastianbergmann This is an attempt to make things more modular / customizable and easier to use in other libs which have custom visualization needs. Thoughts?