refactor code throughout linked_list