Moving everything into a loop and changing subresultArr to subresultContext