Added options for period, debugging, sample size etc