Sampling functions added