Refactored CSV caching (debug mode)