Minor refactoring and adding docstrings