Fixed bug in sampling function (1 variable was not being passed to an internal function). Not works with Master as a function, so I uncommented the sampling part of the Master.R file.