Updating createTexture function