added documentation (not complete and to be tested)