added more documentations plus minor refactoring