Refactored declared Function2 to function literals