Replaced with_frame macro with inlined function that takes a lambda