added docstrings, made it a class