Replace the existing OCR-handling code with a better one