added two variants of lambda with substitution applied anywhere