Taking control over the minibatch loop