Rewrite a bunch of stuff to get model loading working.