refactored exampled