removed unecessary code from refactor. added comments. added some docstrings