doing it with a linked list