first preliminary version
add some docstrings