documentation and code fixes