The indentation of the `N1` loop below suggests it's supposed to be nested within this `HL` loop. But I think you have one too many parentheses after `REF`?