documentation and some fixes