Nztrain rewrite