Implementation of bag template