Added docstrings and removed trailing spaces