refactored texture loading