Merge visgen_base with visgen.
Rework a bunch of routines.