Added addItem function with variable suggestion

I followed the suggestion for adding variables to make things cleaner,
but the same issue still exists. I am unable to make my new item stay.