added helper to find pairs in array