Grandchildren tickets

I need to show the Grandchildren tickets which is a pain but necessary sometimes. I cam up with this script - I know it needs some polishing but here is my script
package com.onresolve.jira.groovy.test.scriptfields.scripts

import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.issue.link.IssueLink
import com.atlassian.jira.issue.CustomFieldManager
import com.atlassian.jira.issue.Issue;

def issueLinkManager = ComponentAccessor.getIssueLinkManager()
def customFieldManager = ComponentAccessor.getCustomFieldManager()

def issuelist =
assert issuelist.empty

// loop through linked tickets
issueLinkManager.getOutwardLinks(issue.id).each {issueLink →
// get parent Object - not sure why but this works
if (issueLink.issueLinkType.name == “Parent”) {
// get child object
def child = issueLink.destinationObject
// loop through child links
issueLinkManager.getOutwardLinks(child.id).each {cissuelink →
// get grandchildren links
// my issue types are Control
if (cissuelink.destinationObject.issueType.name == ‘Control’) {
// add to list
issuelist.add(cissuelink.destinationObject)
}
}
}
}
// return grandchildren list
return issuelist