Reorganized and generalized the idea of generic visitors.

Visitors can now be created through the factory function makeImpl.