improve docstrings, comments, and styles