Rewrote inline discussions hotfix from 58553a7f

In general, this is a very straight forward fix - I decided not to
cherry-pick directly from 58553a7fb8fbc33dfd40c8e7ca39b0f896fb5b32
as the diff exposes very radical differences.