Add examples to doc + cleanup + small refactoring