Keep smart folders when sorting. (see #12294)
Remove commented code and comments

No longer required.
Make sure the smart folder is always at the bottom.
Merge pull request #2598 from jburel/rebased/develop/orphaned-missing

Orphaned missing (rebased onto develop)