changed param bag to bag and added resource concept