refactored OCR