Add documentation and bugfixes