doc
refactoring and first example