deleting extraneous nodes