Added docstrings, few tweaks