Refactored texture loading.