Update docstrings
Reorganize code