Re commit of #4317

This is a recommit of #4317 which was meshed up!