Working version

this version works and is documented
more to come