Some cleanup and working in rewriting tests.