Updated add_item_array function so that it now works when passed a multi-dimensional array.