Inline the initial update_intermediates function.