Pulled out inferScanType to be used on it's own