gamma distribution code, still needs adjusting