move some texture code to a more sensible location