Also, are there any constants for the node type property? Instead of comparing to `1` here or `3` below, it would be better to compare to something with a meaning. If those don't exist, please define them in this function.