changed capture of total, item, and price from global to local variables