Implements PR from @Lindsayanng via #2040