Improved the 'Hide Empty Categories' perfomance