formatted code and updated docstrings