fix error on empty list in table output and added docstrings