Improved sample lister code