Started serious refactoring to code, partly to allow clients to put in a test specific module loader.
Tests passing again.