refactoring ordered linked list