Changed the way to handle textures