OCR and scripting improvements