added tests + docstrings, minor changes