function add_inventory generalized