Modified train script.