Added docstrings and improved whitespace usage