Alternative approach to #4270 without a staged function