improvements to sample