example updated, refactoring