Major refactor of tests.