Rebase #2727

Rebased #2727. Should be good to go, @gkossakowski.