added documentation

* added (rudimentary) documentation
* cleaned up code