some refactoring of the batch and integration samples