def AverageZComparison(x, y):
    """ Take the average of second and third element in an array and compare
    which is bigger. To be used in conjunction with the sort function. """
    xsum = x[1]+x[2]
    ysum = y[1]+y[2]
    if xsum < ysum:
        return -1
    if xsum > ysum:
        return 1
    return 0