first version
clean up and documentation