Adding new items didn't work because it added the new entry to the array before searching if it existed.