Closes gh-24710
This reverts commit ad164269e9 and adds some additional tests. Fixes gh-24192
ad164269e9