Updated for gamma distribution