Initial test infrastructure
Fix a refactoring bug