Refactored texture and cache