refactoring + example