patched version, updated documentation