improved tests
added docstrings to main script