added some docstrings and removed empty lines