Considerable speed up in references by using a helper id instead of looping through everything all the time. The other parts also need to make use of this helper id for even more speed ups.