improved and generated doc, exceptions refactoring