Is there a way not to check value of `node[0]` four times?