More work on fixing texture stuff (not done)