First round of documentation

Also include some untested bugfixes, but shhhhhh…..