Steps toward proper module behavior.

Part of this is also about implementing tests more cleanly for use with
automated testing.