Added support for multiple samples