Exclude hidden directories from search
Minor refactoring