Added directory creation with caching