Bugfixes and documentation