changes linked list to object literal, head not setting correctly