Added gamma function implementation.