Begin write ScanCH function