Linked list refactor