Added support for sampling