Added checks for adding new nodes