used synchronized to make sure we can't modify the update items at two times