now properly checks if a node already exists