remove obsolete code and add docstrings