Switched to a linked list to fix input handling.