Add and improve docstrings.