fixed some hierarchy problems and added docstrings