Move tests to module, fix regressions and get tests running.