added a function to delete nodes and add nodes