Add support for sample with return