works with normal functions as well as lambdas