split train into more specific functions

for each specific tasks