refactored functional style
refactored functional style