In condition for removing IDs from list, the condition was searching for ID instead of ID.value, so it always came back true (==undefined) and removed all IDs from the list