move ocr logic into ocr file