updated slightly for decomposition of gamma