refactor a proc to lambda