Bugfixes and better documentation