Fix an issue with includes and reorganized linked list code