Added docstrings as per @jrioux' suggestion.