Break the itemsInBucket function to merge with beans