Adding support for multiple samples and aggregate method.