refactoring to lambdata