added documentation and fix typos