Update documentation and a couple of bugfixes