Fixed typos + added docstrings and comments