drop unnecessary code, add some docstrings