Some bugfixing an documenting