Improved the way samples per bin are computed.