I updated the code in the first post to implement the config "hideEmptyFolders". It will hide any folders with no visible children.

The speed seems a little slower but it's hardly noticeable.