example refactored