add docstrings, fix paircomp bug