Some refactoring of the example