refactored simple example