added unit tests, fixed off by one error in ocr output processing