training abort code and non resampling stuff