1st solution
refactoring based on best practice solution