Rewrite ScanDirector; improve its test.