Added docstrings and changed tabs to spaces