refactoring on linkedlist remove by element