Reworking to use linked list.