Gathered the lambda creation in one place, called from macro and function definitions with differing function types