Some refactoring in OCR; added collapse-0-to-blank option