Update for latest compiler

I made a bunch of changes that I didn't take the time to understand, but they compile and appear to generate an acceptable image!