Refined tests.
More refactoring.