continuous bag implementation