refactor the example