added some logic to perform a training block