rewrote nest limits in a cleaner way using a NodeVisitor