alter_train changed to funciton