implementing train_main, first step