code works!

still needs better doc
and some cleanup
and maybe some tests
before release...