refactored lambda