working delete method for nodes