added single folder handling and improved category search