add code to train file