Pretty major cleanup effort. Simplifications and such.