restructuring texture handling