More work in ScanState.v