Modified inline parsing to keep track of two pointers - the head of the list and the tail.