Update combinatorics and add docstrings.