Remove some dead code and improve docstrings