Ensured that a node only can be added once and fixed some logic