Clean up some test code, ready for review