moved ocr logic to separate class