Formatted code, removed duplicate logic, fixed transitive test assertions.
Added test cases when there is no POS match for page and line range.