Creating a linked list instead of the old approach should be better
Fixed some bugs in the linked list.