Issue #10:  Updated function so it now only uses 3 nexted loops instead of 5.  Still will socket timeout, but that should be addressed by another issue as other plugins have same issue.