documentation and some bugfixes