replaced ->{} with lambda{} for support for older versions of ruby