add Train function