implemented addNode()