added getTrain function