modified run and added parts for separating test and train