small refactor to lambda