made some changes in sample.R