Replace this with the following and get rid of the loop above:

    if (node.isStateless()) {