Refactor test scanner for testing.