factored out ScanType