Using array of samples instead of a single sample
Fixed bug in previous commit + test