refactor OCR codes; add option of feature scaling