docstrings and cleanup
Adding full integration tests