TrainVM function added