Bag Class and functions