Refactoring F1Functions : replacing anonymous classes using lamda