Re rolling #2809 agaisnt 3.5

@RoySegall Closed the last PR, it was against 3.x 

3.5 Version of #2809