Refactoring the distribution generating functions